package com.wxw.BaseLibrary.component;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.SurfaceView;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

/**
 * Created by david on 2015-04-23.
 */
public class CapturePanel extends FrameLayout {
    private SurfaceView surfaceView;
    private ViewfinderView viewfinderView;

    public CapturePanel(Context context) {
        super(context);
        init(context);
    }

    private void init(Context context){
        surfaceView = new SurfaceView(context);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
        layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
        addView(surfaceView, layoutParams);

        viewfinderView = new ViewfinderView(context, null);
//        layoutParams = new RelativeLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
        viewfinderView.setBackgroundColor(Color.TRANSPARENT);
        addView(viewfinderView, layoutParams);
    }

    public SurfaceView getSurfaceView() {
        return surfaceView;
    }

    public ViewfinderView getViewfinderView() {
        return viewfinderView;
    }
}
